import 'dart:math';

import 'package:flutter/material.dart';

/// author：william on 2021/3/30 11:09
/// email：362661044@qq.com
extension BaseColorExtension on Color {

  Color get lightColor {
    final hslColor = HSLColor.fromColor(this);
    final lightness = min(hslColor.lightness + 0.04, 1.0);
    return hslColor.withLightness(lightness).toColor();
  }

  Color get darkColor {
    final hslColor = HSLColor.fromColor(this);
    final lightness = min(hslColor.lightness - 0.028, 1.0);
    return hslColor.withLightness(lightness).toColor();
  }

}
